package com.fairytask.data
{
	import com.fairytask.event.LogicEvent;
	import com.smartfoxserver.v2.entities.data.SFSObject;
	
	import flash.events.EventDispatcher;

	/**
	 * 数据中心 
	 * @author game
	 * 
	 */	
	public class Modulator extends EventDispatcher
	{
		private static var _instance	:Modulator;
		public var scene	:Scene;
		
		//用户ID
		public var playerId	:String	=	"";
		public var playerKey	:String	=	"";
		
		public static function get instance():Modulator
		{
			if(null==_instance)
			{
				_instance	=	new Modulator();
			}
			return _instance;
		}
		
		public function Modulator()
		{
			super();
			scene	=	new Scene();
		}
		
		public function sendLogicEvent(pKey:String,pData:Object=null):void
		{
			dispatchEvent(new LogicEvent(pKey,pData));
		}
		
		/**
		 * 取得当前玩家信息 
		 * @return 
		 * 
		 */
		public function getPlayerInfo():SFSObject
		{
			return scene.GetProperties(playerId).properties["info"];
		}
	}
}